package hrm.action.popup;

import hrm.action.Action;
import hrm.action.ActionForward;
import hrm.dto.insa.EmployeeDTO;
import hrm.serviceimple.EmployeeServiceImple;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class PopEmployeeListAction implements Action {

	@SuppressWarnings("unchecked")
	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {
		ActionForward actfoward = new ActionForward();
		EmployeeServiceImple service = EmployeeServiceImple.getInstance();
		
		String command2 = request.getParameter("command2");
		String formId = request.getParameter("formId");
		String id = request.getParameter("id");
		String namekor = request.getParameter("namekor");
		
		request.setAttribute("command2", command2);
		request.setAttribute("formId", formId);
		
		
		EmployeeDTO dto = new EmployeeDTO();
		dto.setId(id);
		dto.setNamekor(namekor);
		
		List <EmployeeDTO>list = service.getAllEmployee(dto);
		
		request.setAttribute("list", list);
		
		actfoward.setUrl("popEmployeeList");
		
		return actfoward;
	}
}
